package com.example.client_anna.network.room.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

/**
 * @author cy
 * @email 272884043@qq.com
 * @date 2021/10/19
 */
@Entity(tableName = "order_food_details")
public class Goods {

    //注解：主键，自动增长，强调类型为整型
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id",typeAffinity = ColumnInfo.INTEGER)
    public int id ;

    @ColumnInfo(name = "bid",typeAffinity = ColumnInfo.TEXT)
    public String bid;

    @ColumnInfo(name = "food_id",typeAffinity = ColumnInfo.TEXT)
    public String food_id;

    @ColumnInfo(name = "food_name",typeAffinity = ColumnInfo.TEXT)
    public String food_name;

    //String
    @ColumnInfo(name = "food_image",typeAffinity = ColumnInfo.TEXT)
    public String food_image;

    //Float
    @ColumnInfo(name = "food_price",typeAffinity = ColumnInfo.REAL)
    public Float food_price;

    //Integer
    @ColumnInfo(name = "food_amount",typeAffinity = ColumnInfo.INTEGER)
    public Integer food_amount;

    public Goods(Integer id,String bid,String food_id,String food_name,String food_image,Float food_price,Integer food_amount){
        this.id = id;
        this.bid = bid;
        this.food_id = food_id;
        this.food_name = food_name;
        this.food_image = food_image;
        this.food_price = food_price;
        this.food_amount = food_amount;
    }

    //id自增长
    @Ignore
    public Goods(String bid,String food_id,String food_name,String food_image,Float food_price,Integer food_amount){
        this.bid = bid;
        this.food_id = food_id;
        this.food_name = food_name;
        this.food_image = food_image;
        this.food_price = food_price;
        this.food_amount = food_amount;
    }

    @Override
    public String toString() {
        return "Goods{" +
                "id=" + id +
                ", bid='" + bid + '\'' +
                ", food_id='" + food_id + '\'' +
                ", food_name='" + food_name + '\'' +
                ", food_image='" + food_image + '\'' +
                ", food_price=" + food_price +
                ", food_amount=" + food_amount +
                '}';
    }

}
